package com.ruoyi.system.domain.vo;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;


public class PmsPatientVo implements Serializable {

    @Data
    @ApiModel("人口学管理")
    public class Result {
        @ApiModelProperty("id")
        private Long id;
        @Excel(name = "姓名")
        @ApiModelProperty("姓名")
        private String name;

        @ApiModelProperty("姓名全拼")
        private String pinyinFull;

        @ApiModelProperty("姓名简拼")
        private String pinyinSimple;
        @ApiModelProperty("性别")
        private Byte sex;
        @Excel(name = "年龄")
        @ApiModelProperty("年龄")
        private Integer age;
        @Excel(name = "身份证")
        @ApiModelProperty("身份证")
        private String idCard;
        @Excel(name = "民族")
        @ApiModelProperty("民族")
        private String nation;
        @Excel(name = "联系电话")
        @ApiModelProperty("联系电话")
        private String phone;
        @Excel(name = "身高")
        @ApiModelProperty("身高")
        private String height;
        @Excel(name = "体重")
        @ApiModelProperty("体重")
        private String weight;
        @ApiModelProperty("更新标识：0第一次输入，1更新患者信息")
        private Byte status;
        @Excel(name = "数据来源：0筛查上报、1急救上报、2治疗上报 3康复上报  4应用上报")
        @ApiModelProperty("数据来源：0筛查上报、1急救上报、2治疗上报 3康复上报  4应用上报 ")
        private Integer source;
        @Excel(name = "建档人")
        @ApiModelProperty("建档人")
        private String sourceBy;
        @Excel(name = "建档单位")
        @ApiModelProperty("建档单位")
        private String sourceCompany;
        @ApiModelProperty("建档时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date sourceTime;
        @ApiModelProperty("备注")
        private String remark;
        @ApiModelProperty("创建者")
        private String createBy;
        @ApiModelProperty(" 创建时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date createTime;
        @ApiModelProperty("更新者")
        private String updateBy;
        @ApiModelProperty(" 修改时间")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date updateTime;
        @ApiModelProperty("建档单位")
        private String createCompany;
        @ApiModelProperty("建档年龄")
        @Excel(name = "建档年龄")
        private Integer createAge;
        @ApiModelProperty("户籍地址邮编")
        @Excel(name = "户籍地址邮编")
        private String postalCode;
        @ApiModelProperty("户籍地市")
        @Excel(name = "户籍地市")
        private String registeredCity;
        @Excel(name = "户籍详细地址")
        @ApiModelProperty("户籍详细地址")
        private String registeredCityDetail;
        @Excel(name = "户籍省")
        @ApiModelProperty("户籍省")
        private String registeredProvince;

        private Long dnh;

        public String getSourceBy() {
            return createBy;
        }


        public String getSourceCompany() {
            return createCompany;
        }

        public Date getSourceTime() {
            return createTime;
        }


        public String getBirthDate(){
            if (StrUtil.isNotEmpty(idCard)) {
                return DateUtil.format(IdcardUtil.getBirthDate(idCard), "yyyy-MM-dd");
            }
            return null;
        }
    }

}